import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import scui from './scui'
import i18n from './locales'
import router from './router'
import store from './store'
import App from './App.vue'

const app = createApp(App);

app.use(store);
app.use(router);
app.use(ElementPlus);
app.use(i18n);
app.use(scui);

//挂载app
app.mount('#app');

const debounce = (fn, delay) => {
	let timer = null;
	return (...args) => {
	  if (timer) {
		clearTimeout(timer);
	  }
	  timer = setTimeout(() => {
		fn(...args);
	  }, delay);
	};
  };
  const resizeObserver = window.ResizeObserver;
  window.ResizeObserver = class ResizeObserver extends resizeObserver {
	constructor(callback) {
	  callback = debounce(callback, 200);
	  super(callback);
	}
  };

